<!--
    (c) 2007, Stephane Alnet

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 3
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<input type="hidden" name="_method" value="apply_ethernet" id="_method">

    <fieldset>
        <legend>Interface eth0 (craft port)</legend>
        <p>
            <label>IP Address</label>
            <input type="text" name="eth0_ipv4_address" value="192.168.42.1" disabled="disabled" />
        </p>
        <p>
            <label>Network mask</label>
            <input type="text" name="eth0_ipv4_netmask" value="255.255.255.0" disabled="disabled" />
        </p>
        <p>
            <label>DHCP Server enabled</label>
            <input type="checkbox" name="eth0_dhcp_server" checked="checked" disabled="disabled" />
        </p>
    </fieldset>

<TMPL_LOOP name="interfaces">
    <fieldset>
        <legend>Interface <TMPL_VAR NAME="if_name"> (<TMPL_VAR NAME="if_description">)</legend>
        <p>
            <label>Configuration mode</label>
            <select name="<TMPL_VAR NAME="if_name">_mode" id="<TMPL_VAR NAME="if_name">_mode"  class="trigger">
                <option value="unused">(Unused)</option>
                <option value="static">Static</option>
                <option value="dhcp">DHCP</option>
                <!-- PPPoE -->
            </select>
        </p>

        <div <TMPL_VAR NAME="if_name">_mode="static">
            <p>
                <label>IP Address</label>
                <input type="text" name="<TMPL_VAR NAME="if_name">_ipv4_address" id="<TMPL_VAR NAME="if_name">_ipv4_address"
                    dojoType="dijit.form.ValidationTextBox"
                    regExp="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
                    invalidMessage="Need IP Address"
                 />
            </p>
            <p>
                <label>Network mask</label>
                <select name="<TMPL_VAR NAME="if_name">_ipv4_netmask" id="<TMPL_VAR NAME="if_name">_ipv4_netmask">
                    <option value="255.255.255.0" is_default="true">255.255.255.0 (/24)</option>
                    <option value="255.255.0.0">255.255.0.0 (/16)</option>
                    <option value="255.0.0.0">255.255.0.0 (/8)</option>

                    <option value="255.255.255.128" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.128 (/25)</option>
                    <option value="255.255.255.192" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.192 (/26)</option>
                    <option value="255.255.255.224" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.224 (/27)</option>
                    <option value="255.255.255.240" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.240 (/28)</option>
                    <option value="255.255.255.248" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.248 (/29)</option>
                    <option value="255.255.255.252" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.252 (/30)</option>
                    <option value="255.255.255.254" <TMPL_VAR NAME="if_name">_mode="static">255.255.255.254 (/31)</option>

                    <option value="255.255.128.0">255.255.128.0 (/17)</option>
                    <option value="255.255.192.0">255.255.192.0 (/18)</option>
                    <option value="255.255.224.0">255.255.224.0 (/19)</option>
                    <option value="255.255.240.0">255.255.240.0 (/20)</option>
                    <option value="255.255.248.0">255.255.248.0 (/21)</option>
                    <option value="255.255.252.0">255.255.252.0 (/22)</option>
                    <option value="255.255.254.0">255.255.254.0 (/23)</option>

                    <option value="255.128.0.0">255.128.0.0 (/9)</option>
                    <option value="255.192.0.0">255.192.0.0 (/10)</option>
                    <option value="255.224.0.0">255.224.0.0 (/11)</option>
                    <option value="255.240.0.0">255.240.0.0 (/12)</option>
                    <option value="255.248.0.0">255.248.0.0 (/13)</option>
                    <option value="255.252.0.0">255.252.0.0 (/14)</option>
                    <option value="255.254.0.0">255.254.0.0 (/15)</option>

                </select>
            </p>
            <TMPL_IF NAME="dhcp_server_capable">
            <p>
                <label>DHCP Server enabled</label>
                <input type="checkbox" name="<TMPL_VAR NAME="if_name">_dhcp_server" id="<TMPL_VAR NAME="if_name">_dhcp_server" value="yes" />
            </p>
            </TMPL_IF>
            <TMPL_IF NAME="ipv4_gateway_capable">
            <p>
                <label>Static default gateway (connected to <TMPL_VAR NAME="if_name">)</label>
                <input type="text" name="<TMPL_VAR NAME="if_name">_ipv4_gateway" id="<TMPL_VAR NAME="if_name">_ipv4_gateway"
                    dojoType="dijit.form.ValidationTextBox"
                    regExp="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
                    invalidMessage="Need IP Address"
                 />
            </p>
            </TMPL_IF>
        </div>

    </fieldset>
</TMPL_LOOP>
